package com.noob.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.noob.mapper.UserMapper;
import com.noob.model.User;
import com.noob.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;//这里会报错，但是并不会影响

    @Override
    public int addUser(User user) {
        return userMapper.insert(user);
    }

    @Override
    public List<User> findAllUser(int pageNum, int pageSize) {
        List<User> userList = userMapper.selectPage(
                new Page<User>(pageNum, pageSize),
                new EntityWrapper<User>().eq("2", "2")
        );
        return userList;
    }

}